All Functions of Week 2

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

install.packages

{base}

Install R package

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

slice

{dplyr}

Subset rows using their positions

range

{base}

Return range of values

seq

{base}

Create a sequence

labs

{GGPLOT2}

Customise labels in GGPLOT2

sum

{base}

Get sum of numeric values or a vector

attach

{base}

Attach Set of R Objects to Search Path

select

{dplyr}

Select columns from a tibble/data frame

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

plot

{graphics}

Generic function from base R to produce a plot

rbind

{base}

Combine R objects by rows

cut

{base}

Convert Numeric to Factor

desc

{dplyr}

Arrange in descending order

ungroup

{dplyr}

Resolve grouping created with “group_by”

geom_histogram

{GGPLOT2}

Generates a histogram

library

{base}

Load an R package

filter

{dplyr}

Filter out rows of a data frame according to logical vector

class

{base}

Retrieve class of an R object

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

median

{stats}

Get median of a vector

ifelse

{base}

Return a or b depending on the value of test

is.na

{base}

Check if a value is NA/elements of vector are NA

min

{base}

Get minimum of a vector

lprop

{questionr}

Display row percentages of a two-way frequency table

levels

{base}

Get levels of a factor

sd

{stats}

Get standard deviation of a vector

str

{utils}

Get the structure of an R object

boxplot

{graphics}

Plot a simple box plot

read_excel

{readxl}

Read an Excel file

var

{stats}

Calculate variance

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

ordered

{dplyr}

Create an ordered factor

mean

{base}

Get mean of a vector

geom_bar

{GGPLOT2}

Generates a bar chart

freq

{questionr}

Generate frequency tables

max

{base}

Get maximum of a vector

head

{utils}

Show first 5 rows of a data frame

recode

{dplyr}

Recode a variable

rm

{base}

Remove objects

read.spss

{foreign}

Read a .sav file (SPSS data)

factor

{base}

Create a factor

ggplot

{GGPLOT2}

Create a ggplot graph

pie

{graphics}

Creates a basic pie chart

cbind

{base}

Combine R objects by columns

mutate

{dplyr}

Modify/create a column in a data frame

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

names

{base}

Retrieve names of a list/vector

summary

{base}

Obtain summary statistics or detailed regression output

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

hist

{graphics}

Plot a simple histogram

c

{base}

Combine values/vectors into a vector

setwd

{base}

Set Working Directory

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

The end!